#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
int dp[MAXN];
int ww[MAXN];
int vv[MAXN];

int main(){
	int n,w;
	cin >> n >> w;
	memset(dp,0x3f,sizeof(dp));
	dp[0] = 0;
	for(int i = 1;i <= n;i++){
		cin >> ww[i] >> vv[i];
	}
	for(int i = 1;i <= n;i++){
		for(int j = 100000;j >= vv[i];j--){
			dp[j] = min(dp[j],dp[j - vv[i]] + ww[i]);
		}
	}
	for(int i = 100000;i >= 0;i--){
		if(dp[i] <= w){
			cout << i << "\n";
			break;
		}
	}
}